import request from '@/api/request'

export interface Tag {
  id: number
  name: string
  color?: string
  [k: string]: any
}

export async function listTags() {
    // console.log('Listing tags');
  return request<Tag[]>({
    url: '/tags/list',
    method: 'GET',
  })
}

export async function createTag(data: { name: string }) {
    console.log('Creating tag with data:', data);
  return request<Tag>({
    url: '/tags/create',
    method: 'POST',
    data,
  })
}

export async function deleteTag(id: number | string) {
    console.log('Deleting tag with id:', id);
  return request<null>({
    url: `/tags/delete/${id}`,  
    method: 'DELETE',
  })
}
